package cn.neusoft.query;

import cn.neusoft.pojo.Department;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
public class DepartmentQuery extends BaseQuery{

    private String deptCode;
    private String deptName;
    private String deptType;

    @Override
    public Wrapper getQueryWrapper() {

        QueryWrapper<Department> queryWrapper = new QueryWrapper<>();

        if (StringUtils.isNotEmpty(deptCode)){
            queryWrapper.like("dept_code",deptCode);
        }

        if (StringUtils.isNotEmpty(deptName)){
            queryWrapper.like("dept_name",deptName);
        }

        if (StringUtils.isNotEmpty(deptType)){
            queryWrapper.like("dept_type",deptType);
        }

        return queryWrapper;
    }
}
